package com.huazi.www.drug.drugy.service.impl;


import com.huazi.www.drug.drugy.dao.DrugDao;
import com.huazi.www.drug.drugy.dao.impl.DrugDaoImpl;
import com.huazi.www.drug.drugy.entity.Drug_record;
import com.huazi.www.drug.drugy.entity.Y_drugSelect;
import com.huazi.www.drug.drugy.service.DrugService;
import com.huazi.www.drug.drugy.util.Page;

import java.util.List;

/**
 * @author 波——最帅的男人
 * @version 1.0
 * @date 2021/5/10 10:37
 */
public class DrugServiceImpl implements DrugService {
    DrugDao drugDao = new DrugDaoImpl();

    /**
     * 分页查询
     *
     * @param currentPage
     * @param id
     * @param dataRiqi
     * @return
     */
    @Override
    public Page<Y_drugSelect> pageList(Integer currentPage, String id, String dataRiqi, String dataRiqi2) {
        Page<Y_drugSelect> page = new Page<>();
        page.setPageSize(5);
        page.setCurrentPage(currentPage);
        page.setTotalCount(drugDao.selectPage(id, dataRiqi, dataRiqi2, (currentPage - 1) * page.getPageSize(), page.getPageSize()).size());
        page.setList(drugDao.selectPage(id, dataRiqi, dataRiqi2, (currentPage - 1) * page.getPageSize(), page.getPageSize()));
        return page;
    }

    /**
     * 根据id查询该患者具体开了多少药
     *
     * @param id
     * @return
     */
    @Override
    public List<Drug_record> selectAllDrug(Integer id, String riqi) {
        return drugDao.selectAll(id, riqi);
    }

    /**
     * 修改状态
     *
     * @param id
     * @param
     * @param arr2
     * @return
     */
    @Override
    public boolean updateState(Integer id, String riqi, String[] arr1, String[] arr2) {
        return drugDao.updateState(id, riqi, arr1, arr2);
    }

    /**
     * 查询状态
     *
     * @param id 用户id
     * @return
     */
    @Override
    public int selectZhuangtai(Integer id, String riqi) {
        return drugDao.selectZhuangtai(id, riqi);
    }

    @Override
    public String selectDrugCount(String[] arr1) {
        return drugDao.selectArugCount(arr1);
    }
}
